package com.xiaochong.tir.common.util;

import com.xiaochong.service.common.config.oss.OSSTool;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Project : xc-tir
 * @Package Name : com.xiaochong.tir.common.util
 * @Description : TODO
 * @Author : daizhiqing@xiaochong.com
 * @Creation Date : 2018年08月07日下午4:51
 * @ModificationHistory Who When What
 */
@Component
public class OssImageUtil {

    @Autowired
    OSSTool ossTool;

    public  String fmtImg(String img){

        if(StringUtils.isBlank(img)){
            return null;
        }

        if(!img.startsWith("http")){
            img = ossTool.getOSSUrl(img);
        }
        return img;
    }
}
